import React, { Component } from 'react';
// import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as actions from '../actions/index';
import * as rootactions from '../../../actions';

import SensitiveInfoReport from './sensitiveInfoReport';
import SensitiveBehaviorMonitor from './sensitiveBehaviorMonitor';
import Overview from './overview';
// import Moment from 'moment';
// import BillingMessage from 'components/billing/message';

class Root extends Component {
  renderMain = () => {
    const { activeTab } = this.props;
    if (activeTab === 'overview') {
      return <Overview {...this.props} />;
    } else if (activeTab === 'behavior') {
      return <SensitiveBehaviorMonitor {...this.props} />;
    } else {
      return <SensitiveInfoReport {...this.props} />;
    }
  };

  render() {
    // const { enterprisePackage } = this.props;
    // const billing = enterprisePackage && enterprisePackage.order_info && enterprisePackage.order_info.order_id;
    // const billingValue = billing ? Moment(enterprisePackage.order_info.end_date).diff(Moment(), 'day') : 0;
    return this.renderMain();
  }
}

export default connect(
  (state) => ({
    ...state.organization.settings.risk,
    settings: state.organization.settings.settings,
    enterprisePackage: state.organization.settings.settings.enterprisePackage,
  }),
  (dispatch) => bindActionCreators(Object.assign({}, rootactions, actions), dispatch),
)(Root);
